package cn.project.engineering.utils;

import android.content.Context;
import android.util.DisplayMetrics;
import android.view.WindowManager;

public class WonderfulScreenSize {
    private  static WonderfulScreenSize instance=null;
    private  int screenWith,screenHight;
    public static WonderfulScreenSize getInstance(Context mContext){
        if (instance==null){
            synchronized (WonderfulScreenSize.class){
                if (instance==null)
                    instance=new WonderfulScreenSize(mContext);
            }
        }
        return instance;
    }
    private WonderfulScreenSize(Context mContext){
        WindowManager manager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
        DisplayMetrics displayMetrics=new DisplayMetrics();
        manager.getDefaultDisplay().getRealMetrics(displayMetrics);
        screenWith=displayMetrics.widthPixels;
        screenHight=displayMetrics.heightPixels;

    }

    public void setScreenHight(int screenHight) {
        this.screenHight = screenHight;
    }
    public  int getScreenWith(){
        return screenWith;
    }
    public  int getScreenHight(){
        return screenHight;
    }



    class innerClass{
        private  innerClass instance=null;
        private Context mcontent;
       private  innerClass(Context mcontent){
           this.mcontent=mcontent;
       }
           public innerClass  getInstance(Context mcontent){
           if (instance==null){
               synchronized (innerClass.class){
                   if (null==instance){
                       instance=new innerClass(mcontent);
                   }
               }
           }

           return instance;
       }



    }
}
